﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ShopCart.aspx.cs" Inherits="FYPHP.ShopCart" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="LeftContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript">    var num = 0; num1 = 0;</script>
<asp:Panel ID="Panel1" runat="server">
        <asp:Label ID="lblUserName" runat="server" Visible="false"></asp:Label>
        <asp:Label ID="lblUserID" runat="server" Visible="false"></asp:Label>
    </asp:Panel>
    <h2>Shopping Cart</h2>
        <asp:Repeater ID="Repeater1" runat="server" EnableViewState="False" onitemcommand="ItemList_ItemCommand">
        <HeaderTemplate>
        <table cellpadding="5" cellspacing="5" width="100%" border="1" bordercolor="#aaaaaa"  align="center" style="border-collapse: collapse; text-align: center">
 <tr style="background-color: #eee; font-weight: bold;"><td width="30px">No.</td><td>Shop Name</td><td width="195px">Actions</td></tr>
 </HeaderTemplate>
<ItemTemplate>
<tr>
     <td><script type="text/javascript">             num += 1; document.write(num);</script></td>
     <td><%#DataBinder.Eval(Container.DataItem, "username" ) %>'s Virtual Shop</td>
     <td><asp:Button ID="btnView" runat="server" Text="View" CommandName="ViewCart" 
        CommandArgument='<%# Eval("t_id").ToString() %>' />
        <asp:Button ID="btnDelete" runat="server" Text="Delete" CommandName="DeleteCart" 
        CommandArgument='<%# Eval("t_id").ToString() %>' />
        <asp:Button ID="btnCheckOut" runat="server" Text="Check Out" CommandName="CheckOut" 
        CommandArgument='<%# Eval("t_id").ToString() %>' />
    </td>
     </tr>
     </ItemTemplate>

   <FooterTemplate>
    </FooterTemplate>
</asp:Repeater>

     </table>

    <br />

    <asp:MultiView ID="MultiView1" runat="server">
        <asp:View ID="View1" runat="server">
<asp:Repeater ID="ShoppingCartItemList" runat="server"  onitemcommand="ShopCart_ItemCommand">

<HeaderTemplate>
<table cellpadding="5" cellspacing="5" width="100%" border="1" bordercolor="#aaaaaa"  align="center" style="border-collapse: collapse; text-align: center">
 <tr style="background-color: #eee; font-weight: bold;"><td width="30px">No.</td><td>Picture</td><td>Product Name</td><td>Price</td><td>Quantity</td><td>Total</td><td>Action</td></tr>

</HeaderTemplate>

<ItemTemplate>
     <tr>
     <td><script type="text/javascript">             num1 += 1; document.write(num1);</script></td>
            <td align="center" width="50">
            <img src="\uploads\products\<%#DataBinder.Eval(Container.DataItem, "p_picture" ) %>" alt="" height="40px" width="40px" />
            </td>
            <td style="text-align: left"><a href="/ProductDetails.aspx?id=<%#DataBinder.Eval(Container.DataItem, "p_id" ) %>">
            <%#DataBinder.Eval(Container.DataItem, "p_name" ) %></a> <br /> 
            <i style="font-size:11px;"><%#DataBinder.Eval(Container.DataItem, "p_desc" ) %></i></td>

            <td width="70">RM <%#DataBinder.Eval(Container.DataItem, "p_price" ) %> </td>
            <td width="25"><%#DataBinder.Eval(Container.DataItem, "quantity" ) %> </td>
            <td width="70"><%# processData(DataBinder.Eval(Container.DataItem, "quantity"), DataBinder.Eval(Container.DataItem, "p_price"))%></td>
        <td width="50"><asp:Button ID="btnDelete" runat="server" Text="Delete" CommandName="DeleteCartItem" 
        CommandArgument='<%# Eval("tp_id").ToString() %>' />
  </td> 
        </tr>

       
   </ItemTemplate>

   <FooterTemplate>
    </FooterTemplate>

</asp:Repeater>

   <tr><td colspan="5"></td><td>
       <asp:Label ID="lblTotal" runat="server"></asp:Label></td></tr>
    </table>
            </asp:View>
    </asp:MultiView>
</asp:Content>
